package com.heima.day528_二维数组;

public class TwodArray {

    //选中需要注释的内容，ctel+shift+/进行多行注释
    public static void main(String[] args) {
        int[] arr1 = {1, 2, 3};
        int[] arr2 = {4, 5, 6};

        //int[][] arr = {arr1, arr2};

        int[][] arr = {{1, 2, 3}, {4, 5, 6}};
        System.out.println(arr[1][1]);
        System.out.println("循环");

        forXh (arr);

    }

    public static void prt(int arr[][]) {
        arr[1][2] = 99;
        arr[0][2] = 99;

    }
    public static void forXh(int arr[][]){
        int sum=0;
        //二维数组的遍历---循环嵌套：外层循环走一步，内层循环跑一圈
        //循环二维数组
        for (int i = 0; i < arr.length; i++) {
            //循环一维数组
            for (int j=0; j<arr[i].length;j++){
                System.out.print(arr[i][j]);
                sum+=arr[i][j];
            }
        }
        System.out.println("   ");
        System.out.println("sum = "+sum);
    }


}
